<?php

/**
 * @file
 * Theme setting callbacks for the garland theme.
 */

/**
 * Implements hook_form_FORM_ID_alter().
 *
 * @param $form
 *   The form.
 * @param $form_state
 *   The form state.
 */
function weitheme_form_system_theme_settings_alter(&$form, &$form_state) {

  // $form['garland_width'] = array(
  //   '#type' => 'radios',
  //   '#title' => t('Content width'),
  //   '#options' => array(
  //     'fluid' => t('Fluid width'),
  //     'fixed' => t('Fixed width'),
  //   ),
  //   '#default_value' => theme_get_setting('garland_width'),
  //   '#description' => t('Specify whether the content will wrap to a fixed width or will fluidly expand to the width of the browser window.'),
  //   // Place this above the color scheme options.
  //   '#weight' => -2,
  // );
  $menus = _get_menu_options();

  $form['weitheme_navbars'] = array(
    '#type' => 'fieldset',
    '#title' => t('Navbars Settings'),
    '#collapsible' => true,
    '#collapsed' => false,
    '#weight' => -10,
  );

  $form['weitheme_navbars']['weitheme_top_navbar'] = array(
    '#type' => 'select',
    '#title' => 'Top navbar menu',
    '#description' => t('Choose a menu that you want to use as the top navbar.'),
    '#options' => $menus,
    '#default_value' => theme_get_setting('weitheme_top_navbar'),
  );
  $form['weitheme_navbars']['weitheme_bottom_navbar'] = array(
    '#type' => 'select',
    '#title' => 'Bottom navbar menu',
    '#description' => t('Choose a menu that you want to use as the bottom navbar.'),
    '#options' => $menus,
    '#default_value' => theme_get_setting('weitheme_bottom_navbar'),
  );
}

function _get_menu_options(){

  $options = array('none' => '<none>');
  $menus = menu_get_menus();
  $options += $menus;

  return $options;
}
